﻿CREATE PROCEDURE [dbo].[LastEntryDetails]

AS
SELECT        MAX(el.EntryDate) AS LastEntry, u.FullName, ut.TypeName, u.UserID
FROM            EntryLog AS el INNER JOIN
                         Users AS u ON el.UserID = u.UserID INNER JOIN
                         UserType AS ut ON u.UserTypeID = ut.UserTypeID
WHERE        (u.IsActive = 1)
GROUP BY u.FullName, u.UserID, u.UserTypeID, ut.TypeName
ORDER BY u.UserTypeID DESC, LastEntry DESC

